package cn.reach.rpc;

/**
 * RPC配置类
 */
public class RpcConfig {
    private int defaultTimeout = 5000; // 默认超时时间(毫秒)
    private int retryTimes = 0; // 重试次数
    private long retryInterval = 1000; // 重试间隔(毫秒)
    private boolean failFast = true; // 快速失败模式

    public static RpcConfig createDefault() {
        return new RpcConfig();
    }

    public int getDefaultTimeout() {
        return defaultTimeout;
    }

    public void setDefaultTimeout(int timeout) {
        this.defaultTimeout = timeout;
    }

    public int getRetryTimes() {
        return retryTimes;
    }

    public RpcConfig setRetryTimes(int retryTimes) {
        this.retryTimes = retryTimes;
        return this;
    }

    public long getRetryInterval() {
        return retryInterval;
    }

    public RpcConfig setRetryInterval(long retryInterval) {
        this.retryInterval = retryInterval;
        return this;
    }

    public boolean isFailFast() {
        return failFast;
    }

    public RpcConfig setFailFast(boolean failFast) {
        this.failFast = failFast;
        return this;
    }
}